<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
    
    <rich:panel>
        <f:facet name="header">User</f:facet>

        <s:decorate id="username" template="layout/display.xhtml">
            <ui:define name="label">username</ui:define>
            #{userHome.instance.username}
        </s:decorate>

        <s:decorate id="password" template="layout/display.xhtml">
            <ui:define name="label">password</ui:define>
            #{userHome.instance.password}
        </s:decorate>

        <s:decorate id="name" template="layout/display.xhtml">
            <ui:define name="label">name</ui:define>
            #{userHome.instance.name}
        </s:decorate>

        <div style="clear:both"/>
        
    </rich:panel>
    
    <div class="actionButtons">      

        <s:button view="/UserEdit.xhtml" 
                    id="edit" 
                 value="Edit"/>

        <s:button view="/#{empty userFrom ? 'UserList' : userFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

   <rich:tabPanel switchType="ajax">

   <rich:tab label="contents">
   <div class="association" id="contentsChildren">

       <h:outputText value="No contents"
                  rendered="#{empty userHome.contents}"/>

       <rich:dataTable value="#{userHome.contents}"
                      var="content"
                 rendered="#{not empty userHome.contents}"
               rowClasses="rvgRowOne,rvgRowTwo"
                       id="contentsTable">
           <h:column>
               <f:facet name="header">id</f:facet>
               <h:outputText value="#{content.id}"/>
           </h:column>
           <h:column>
               <f:facet name="header">title</f:facet>
               <h:outputText value="#{content.title}"/>
           </h:column>
           <h:column>
               <f:facet name="header">creationDate</f:facet>
               <h:outputText value="#{content.creationDate}"/>
           </h:column>
           <h:column>
               <f:facet name="header">action</f:facet>
               <s:link id="selectcontent"
                    value="Select"
                     view="/Content.xhtml">
                   <f:param name="contentId"
                           value="#{content.id}"/>
                   <f:param name="contentFrom" value="User"/>
               </s:link>
           </h:column>
       </rich:dataTable>

   </div>

   </rich:tab>
  </rich:tabPanel>

</ui:define>

</ui:composition>
